import { fontConfig } from '../commonSetting';

export default {
  name: '区域联动层',
  code: 'custom_map_group_geojson',
  version: '1.0.0',
  config: [
    {
      name: '基础设置',
      code: 'base',
      children: [
        {
          name: '下钻层级',
          code: 'floor',
          value: 'province',
          type: 'Radio',
          enumValue: [
            {
              key: '无',
              value: 'province',
            },
            {
              key: '省',
              value: 'city',
            },
            {
              key: '市',
              value: 'district',
            },
            {
              key: '区',
              value: 'bottom',
            },
          ],
        },
        {
          name: '边界粗细',
          code: 'weight',
          type: 'InputNumber',
          value: 1,
          min: 0,
          max: 99,
          unit: 'px',
        },
        {
          name: '边界颜色',
          code: 'color',
          type: 'ColorSelector',
          value: '#82B8FC',
        },
        {
          name: '填充颜色',
          code: 'colors',
          type: 'RangeColors',
          min: 1,
          value: [
            {
              id: 1000,
              start: 0,
              end: 15,
              color: '#0233CE',
            },
            {
              id: 999,
              start: 15,
              end: 30,
              color: '#0159FF',
            },
            {
              id: 998,
              start: 30,
              end: 45,
              color: '#2E73FC',
            },
            {
              id: 997,
              start: 45,
              end: 60,
              color: '#4E8DFD',
            },
            {
              id: 996,
              start: 60,
              end: 100,
              color: '#7CB0FA',
            },
          ],
          template: {
            start: 0,
            end: 100,
            color: '#0233CE',
          },
        },
      ],
    },
    {
      name: '提示框设置',
      code: 'tooltip',
      children: [
        {
          code: 'show',
          value: 'hover',
          type: 'Radio',
          enumValue: [
            {
              key: '无提示',
              value: 'hide',
            },
            {
              key: '提示一直存在',
              value: 'always',
            },
            {
              key: '鼠标划过提示',
              value: 'hover',
            },
          ],
        },
        fontConfig,
        {
          name: '边框线条粗细',
          code: 'borderWidth',
          min: 0,
          value: 1,
          type: 'InputNumber',
          unit: 'px',
        },
        {
          name: '边框线条色',
          code: 'borderColor',
          value: '#3399CC',
          type: 'ColorSelector',
        },
        {
          name: '背景来源',
          code: 'background',
          type: 'ChangeConfig',
          value: {
            type: 'color',
            backgroundColor: '#369',
            imageUrl: '',
          },
          enumValue: [
            {
              key: '颜色背景',
              value: 'color',
              change: [
                {
                  name: '背景颜色设置',
                  code: 'backgroundColor',
                  type: 'ColorSelector',
                },
              ],
            },
            {
              key: '图片背景',
              value: 'image',
              change: [
                {
                  name: '背景图片地址',
                  code: 'imageUrl',
                  type: 'ImgUpdate',
                },
              ],
            },
          ],
        },
      ],
    },
    {
      name: '按钮设置',
      code: 'button',
      children: [
        fontConfig,
        {
          name: '背景颜色',
          code: 'backgroundColor',
          value: '#666',
          type: 'ColorSelector',
        },
      ],
    },
  ],
  data: {
    type: 1,
    field: [
      { name: 'adcode', mapper: 'adcode' },
      { name: 'value', mapper: 'value', optional: true },
      { name: 'tooltip', mapper: 'name', optional: true },
    ],
    value: JSON.stringify([
      { value: '11', name: '北京市', adcode: '110000' },
      { value: '12', name: '天津市', adcode: '120000' },
      { value: '31', name: '上海市', adcode: '310000' },
      { value: '65', name: '新疆维吾尔自治区', adcode: '650000' },
      { value: '54', name: '西藏自治区', adcode: '540000' },
      { value: '15', name: '内蒙古自治区', adcode: '150000' },
      { value: '63', name: '青海省', adcode: '630000' },
      { value: '51', name: '四川省', adcode: '510000' },
      { value: '23', name: '黑龙江省', adcode: '230000' },
      { value: '62', name: '甘肃省', adcode: '620000' },
      { value: '53', name: '云南省', adcode: '530000' },
      { value: '45', name: '广西壮族自治区', adcode: '450000' },
      { value: '43', name: '湖南省', adcode: '430000' },
      { value: '61', name: '陕西省', adcode: '610000' },
      { value: '44', name: '广东省', adcode: '440000' },
      { value: '22', name: '吉林省', adcode: '220000' },
      { value: '13', name: '河北省', adcode: '130000' },
      { value: '42', name: '湖北省', adcode: '420000' },
      { value: '52', name: '贵州省', adcode: '520000' },
      { value: '37', name: '山东省', adcode: '370000' },
      { value: '36', name: '江西省', adcode: '360000' },
      { value: '41', name: '河南省', adcode: '410000' },
      { value: '21', name: '辽宁省', adcode: '210000' },
      { value: '14', name: '山西省', adcode: '140000' },
      { value: '34', name: '安徽省', adcode: '340000' },
      { value: '35', name: '福建省', adcode: '350000' },
      { value: '33', name: '浙江省', adcode: '330000' },
      { value: '32', name: '江苏省', adcode: '320000' },
      { value: '50', name: '重庆市', adcode: '500000' },
      { value: '64', name: '宁夏回族自治区', adcode: '640000' },
      { value: '46', name: '海南省', adcode: '460000' },
      { value: '71', name: '台湾省', adcode: '710000' },
      { value: '81', name: '香港', adcode: '810000' },
      { value: '82', name: '澳门', adcode: '820000' },
    ]),
  },
  events: {
    click: {
      description: '地区点击响应事件',
      fields: {
        adcode: {
          mapper: '',
          description: '地区编码',
          value: 100000,
        },
      },
    },
  },
};
